<?php

namespace common\models\shop;

use Yii;

/**
 * This is the model class for table "{{%shop_channel}}".
 *
 * @property int $id
 * @property string $name 分类名称
 * @property string $description
 * @property string $link 分类图标
 * @property string $bgcolor 分类图
 * @property string $image 层级
 * @property int $listorder 排序
 * @property int $status 状态
 * @property string $created_at 创建时间
 * @property string $updated_at 更新时间
 */
class ShopChannel extends \common\db\ActiveRecord {

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return '{{%shop_channel}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['name'], 'required'],
            [['listorder', 'status', 'created_at', 'updated_at'], 'integer'],
            [['name'], 'string', 'max' => 50],
            [['description', 'link', 'image'], 'string', 'max' => 255],
            [['bgcolor'], 'string', 'max' => 7],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'name' => '分类名称',
            'description' => 'Description',
            'link' => '分类图标',
            'bgcolor' => '分类图',
            'image' => '层级',
            'listorder' => '排序',
            'status' => '状态',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }

    public function fields() {
        return [
            'name',
            'link',
        ];
    }

}
